module Maybe
  def self.just(value) Just.new(value) end
  def self.nothing; Nothing end
  
  class Just
    def initialize(value)
      @value = value
    end
    
    def just; yield @value end
    def nothing; end
  end
  
  class NothingClass
    def just; end
    def nothing; yield end
  end
  Nothing = NothingClass.new
end

module Kernel
  def just(value) Maybe.just(value) end
  def nothing; Maybe.nothing end
end
